<template>
    <div>

        <div class="week-content">
            <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
                <NovelX v-for="  ( item, index )  in novellist" :novelitem="item" :key="item.id" />
              
            </van-list>

        </div>


    </div>
</template>

<script>
import  {week}  from '@/api/home'
import NovelX from '../com/novelX.vue'
export default {
    components: { NovelX },
    data() {
        return {
            loading: false,
            finished: false,
            novellist: [],
            option: { page: 1, size: 5 }
        }
    },

    methods: {
        onLoad() {
            this.addlist()
            this.option.page++
        },
        async addlist() {
            let result = await week(this.option)
            if (result.data.list.length < this.option.size) {
                this.finished = true
            }
            //  把以前的结果也叠加到一起去 
            console.log(result);
            this.novellist = [...this.novellist, ...result.data.list]

            this.loading = false
        }
    },

}
</script>

<style lang="scss" scoped>

</style>